//
//  SendDoorwayAndInteriorPhotosViewController.m
//  跨界收
//
//  Created by Allen on 2018/11/20.
//  Copyright © 2018年 gztx. All rights reserved.
//

#import "SendDoorwayAndInteriorPhotosViewController.h"
#import "ExamplePhotoView.h"
#import "AddPhotoView.h"

@interface SendDoorwayAndInteriorPhotosViewController ()
@property (nonatomic, strong) AddPhotoView *addPhotoView1;
@property (nonatomic, strong) AddPhotoView *addPhotoView;
@end

@implementation SendDoorwayAndInteriorPhotosViewController
-(void)createFirstPartView
{
    ExamplePhotoView *photoView = [[ExamplePhotoView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 235) withArray:@[@"前景照示例",@"内景照示例",@"内景照示例",@"内景照示例"] imageArray:@[@"photo1",@"photo2",@"photo3",@"photo4"]];
    [self.view addSubview:photoView];
}
- (void)createSecondPartView
{
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 245, SCREEN_WIDTH, 155)];
    view.backgroundColor = [UIColor whiteColor];
    _addPhotoView1 = [AddPhotoView shareIntance];
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap1:)];
    [_addPhotoView1.addIamgeView addGestureRecognizer:tap];
    _addPhotoView1.titleLabel.text = @"上传前台照";
    _addPhotoView1.contentLabel.text = @"请确保使用实景照，前台照清晰可见，无水印";
    _addPhotoView1.frame = CGRectMake(0, 0, SCREEN_WIDTH, 135);
    [view addSubview:_addPhotoView1];
    [self.view addSubview:view];
}

- (void)tap1:(UITapGestureRecognizer *)tap
{
    NSLog(@"dianji");
    UIImageView *imageview = (UIImageView *)tap.view;
    WeakSelf;
    [[LYLPhotoTailoringTool sharedTool]photoTailoring:^(UIImage *image) {
        imageview.image = image;
        weakSelf.addPhotoView1.deleteButton.hidden = NO;
        weakSelf.addPhotoView1.countLabel.text = [NSString stringWithFormat:@"1/1"];
    }];
}
- (void)createThreePartView
{
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 410, SCREEN_WIDTH, 155)];
    view.backgroundColor = [UIColor whiteColor];
    _addPhotoView = [AddPhotoView shareIntance];
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)];
    [_addPhotoView.addIamgeView addGestureRecognizer:tap];
     self.addPhotoView.countLabel.text = [NSString stringWithFormat:@"0/5"];
    _addPhotoView.titleLabel.text = @"上传内景照";
    _addPhotoView.contentLabel.text = @"请确保使用实景照，图片清晰可见，无水印，建议多角度拍摄";
    _addPhotoView.frame = CGRectMake(0, 0, SCREEN_WIDTH, 155);
    [view addSubview:_addPhotoView];
    [self.view addSubview:view];
}
- (void)tap:(UITapGestureRecognizer *)tap
{
    NSLog(@"dianji");
    UIImageView *imageview = (UIImageView *)tap.view;
    WeakSelf;
    [[LYLPhotoTailoringTool sharedTool]photoTailoring:^(UIImage *image) {
        imageview.image = image;
        weakSelf.addPhotoView.deleteButton.hidden = NO;
        weakSelf.addPhotoView1.countLabel.text = [NSString stringWithFormat:@"1/1"];
    }];
}
- (void)createSubmitButton
{
    CGFloat h = 64.0;
    if (WYFIphoneX) {
        h = 88.0;
    }
    UIButton *submitButton = [[UIButton alloc] initWithFrame:CGRectMake(30, SCREEN_HEIGHT-30-h-50, SCREEN_WIDTH-60, 50)];
    [submitButton setTitle:@"提 交" forState:UIControlStateNormal];
    [submitButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    submitButton.backgroundColor = [UIColor colorWithRGB:0x239fdb];
    [self.view addSubview:submitButton];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"上传门口照及内景照";
    [self createFirstPartView];
    [self createSecondPartView];
    [self createThreePartView];
    [self createSubmitButton];
    // Do any additional setup after loading the view from its nib.
}



@end
